package com.gao.String;

/**
 * @Author: ShanYuqing
 * @Version: v1.0
 */
public class StringMehodDemo2 {
    /*
            String类用于遍历的方法：
                Char[] toCharArray() 将此字符串转换为一个新的字符数组

                public char charAt(int index) 返回指定索引值的char值

                public int length()  返回字符串的长度
     */
    public static void main(String[] args) {
//        print1();
          print2();
    }

    private static void print2() {
        String c = "aadda";
        for (int i = 0; i < c.length(); i++) {
            char s = c.charAt(i);
            System.out.println(s);
        }
    }

    private static void print1() {
        String s = "ssdsdsd";
        char[] charArray = s.toCharArray();
        for (int i = 0; i < charArray.length; i++) {
            System.out.println(charArray[i]);
        }
    }
}
